﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace MyEngineExercise.工作.分割图层_20120810
{
    public partial class Choose_unit : Form
    {
        public Choose_unit()
        {
            InitializeComponent();
        }

        public string GetUnit
        {
            get 
            {
                if (radioButton1.Checked == true) 
                    return "米";

                return "公里";
            }
        }

        public string GetLength
        {
            get { return this.textBox1.Text;}
        }


        private void button1_Click(object sender, EventArgs e)
        {
            Regex regex = new Regex(@"^[0-9]+$");

            if (this.textBox1.Text == string.Empty)
            {
                MessageBox.Show("不能留空！","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
            else if (regex.IsMatch(this.textBox1.Text) == false)
            {
                MessageBox.Show("只能输入整数！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            
        }
    }
}
